﻿$().ready(function() {
    $("#registerForm").validate({
        rules: {
          tname: {
        	  required: true,
        	  remote: {
        		    url: "checkName.action",     //后台处理程序
        		    type: "post",               //数据发送方式
        		    dataType: "json",           //接受数据格式   
        		    data: {                     //要传递的数据
        		        username: function() {
        		            return $("#tname").val();
        		        }
        		    }
        		}
          },
          tpassword: "required",
        },
        messages: {
        	tname: {
          	  required: "姓名不能为空",
          	  remote: "姓名已存在，请重新输入"
            },
            tpassword: "请输入您的密码"
        }
    })
});